//
//  FlutterEventPlugin.swift
//  Runner
//
//  Created by KayoXu on 2019/11/12.
//  Copyright © 2019 Kayo Xu. All rights reserved.
//

import Foundation
class FlutterEventPlugin:NSObject, FlutterStreamHandler {
    var eventSink:FlutterEventSink?=nil;
    
    static let share: FlutterEventPlugin = {
        let instance = FlutterEventPlugin.init()
        
        return instance
    }()
    
    func registerWithRegistry(messenger: FlutterBinaryMessenger) {
        
        let eventStr = "com.kayoxu.plugin/bleEvent"
        let event = FlutterEventChannel.init(name: eventStr, binaryMessenger: messenger)
        
        event.setStreamHandler(self)
    }
    
    func onListen(withArguments arguments: Any?, eventSink events: @escaping FlutterEventSink) -> FlutterError? {
        self.eventSink = events
        var d = arguments
        
        return nil
    }
    
    func onCancel(withArguments arguments: Any?) -> FlutterError? {
        
        return nil
    }
    
    
}
